<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>块级作用域</title>
</head>

<body>


</body>

</html>
<script>
const a = [];
a.push('Hello'); 

a.push('World');
alert(a) // 可执行
a.length = 1;   
a.push('!');     // 可执行
a.length = 2;   


const foo = Object.freeze({});
// 常规模式时，下面一行不起作用；
// 严格模式时，该行会报错
foo.prop = 123;
alert(foo.prop); // undefined

var constantize = (obj) => {
    Object.freeze(obj);
    Object.keys(obj).forEach( (key, i) => {
      if ( typeof obj[key] === 'object' ) {
        constantize( obj[key] );
      }
    });
  };
  

</script>



<style> 

</style>